<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            /* 设置div的宽高使其大于图片的大小 */
            width: 400px;
            height: 100px;
            border: 1px solid #ff0000;
            /* 设置一个背景图片 */
            background-image: url("./log50.png");
            /* 不重复 */
            background-repeat: no-repeat;
        }

        .div1 {
            /* 左偏移5像素，上偏移10像素 */
            background-position: 5px 10px;
        }

        .div2 {
            /* 左偏移10%，上偏移20% */
            background-position: 10% 20%;
        }

        .div3 {
            /* 关键字方式 */
            background-position: left center;
        }

        .div4 {
            /* CSS3新增 */
            background-position: left 20px top 10%;
        }
    </style>
</head>
<body>
    <p>background-position: 5px 10px;</p>
    <div class="div1"></div>
    <p>background-position: 10% 20%;</p>
    <div class="div2"></div>
    <p>background-position: left center;</p>
    <div class="div3"></div>
    <p> background-position: left 20px top 10%;</p>
    <div class="div4"></div>
</body>
</html>